package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.Item;
import com.xx.pmis.persistence.dao.ItemDAO;
import com.xx.pmis.services.ItemService;

public class ItemServiceImpl implements ItemService {
	ItemDAO itemDAO = null;

	public ItemServiceImpl(ItemDAO itemDAO) {
		super();
		this.itemDAO = itemDAO;
	}

	public void saveOrUpdateItem(Item item) throws Exception {
		itemDAO.saveOrUpdate(item);
	}

	public void saveItem(Item item) throws Exception {
		itemDAO.save(item);
	}

	public void deleteItem(Item item) throws Exception {
		itemDAO.delete(item);
	}

	public Item getItemByItemID(String itemID) throws Exception {
		Item Item = itemDAO.getItemByItemID(itemID);
		return Item;
	}

	public List<Item> getAllWaitingItem() throws Exception {
		List<Item> Items = itemDAO.getAllWaitingItem();
		return Items;
	}
	
	public List<Item> getAllAccomplishItem() throws Exception {
		List<Item> Items = itemDAO.getAllAccomplishItem();
		return Items;
	}

	public List<Item> getAllAccomplishItemByPage(int currentPage, int lineSize) throws Exception {
		List<Item> Items = itemDAO.getAllAccomplishItemByPage(currentPage, lineSize);
		return Items;
	}

	public int getCountOfAccomplishItem() throws Exception {
		return itemDAO.getAllAccomplishItem().size();
	}

}
